package net.lab1024.sa.admin.module.business.lcy.student.contact.controller;

import net.lab1024.sa.admin.module.business.lcy.student.contact.domain.form.LcyStudentContactAddForm;
import net.lab1024.sa.admin.module.business.lcy.student.contact.domain.form.LcyStudentContactQueryForm;
import net.lab1024.sa.admin.module.business.lcy.student.contact.domain.form.LcyStudentContactUpdateForm;
import net.lab1024.sa.admin.module.business.lcy.student.contact.domain.vo.LcyStudentContactVO;
import net.lab1024.sa.admin.module.business.lcy.student.contact.service.LcyStudentContactService;
import net.lab1024.sa.base.common.domain.ValidateList;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import net.lab1024.sa.base.common.domain.ResponseDTO;
import net.lab1024.sa.base.common.domain.PageResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import cn.dev33.satoken.annotation.SaCheckPermission;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;

/**
 * 联系人 Controller
 *
 * @Author yangz
 * @Date 2025-10-31 19:00:52
 * @Copyright yangz
 */

@RestController
@Tag(name = "联系人")
public class LcyStudentContactController {

    @Resource
    private LcyStudentContactService lcyStudentContactService;

    @Operation(summary = "分页查询 @author yangz")
    @PostMapping("/lcyStudentContact/queryPage")
    @SaCheckPermission("lcyStudentContact:query")
    public ResponseDTO<PageResult<LcyStudentContactVO>> queryPage(@RequestBody @Valid LcyStudentContactQueryForm queryForm) {
        return ResponseDTO.ok(lcyStudentContactService.queryPage(queryForm));
    }

    @Operation(summary = "添加 @author yangz")
    @PostMapping("/lcyStudentContact/add")
    @SaCheckPermission("lcyStudentContact:add")
    public ResponseDTO<String> add(@RequestBody @Valid LcyStudentContactAddForm addForm) {
        return lcyStudentContactService.add(addForm);
    }

    @Operation(summary = "更新 @author yangz")
    @PostMapping("/lcyStudentContact/update")
    @SaCheckPermission("lcyStudentContact:update")
    public ResponseDTO<String> update(@RequestBody @Valid LcyStudentContactUpdateForm updateForm) {
        return lcyStudentContactService.update(updateForm);
    }

    @Operation(summary = "批量删除 @author yangz")
    @PostMapping("/lcyStudentContact/batchDelete")
    @SaCheckPermission("lcyStudentContact:delete")
    public ResponseDTO<String> batchDelete(@RequestBody ValidateList<Long> idList) {
        return lcyStudentContactService.batchDelete(idList);
    }

    @Operation(summary = "单个删除 @author yangz")
    @GetMapping("/lcyStudentContact/delete/{contactId}")
    @SaCheckPermission("lcyStudentContact:delete")
    public ResponseDTO<String> batchDelete(@PathVariable Long contactId) {
        return lcyStudentContactService.delete(contactId);
    }
}
